package com.coins.common.jobs;

import com.coins.agent.HTTPEvents;

public class JobMessage implements Comparable<JobMessage> {

	private String msgId;
	/** 优先级 */
	private int priority;
	/** 请求方法 */
	private HTTPEvents events;
	/** 请求参数 */
	private Object data;
	/** 返回数据 */
	private Object result;
	/** 处理结果 */
	private JobHandler handler;

	public JobMessage() {
	}

	public JobMessage(int priority, HTTPEvents events, Object data, JobHandler handler) {
		this.priority = priority;
		this.events = events;
		this.data = data;
		this.handler = handler;
	}

	@Override
	public int compareTo(JobMessage o) {
		return this.priority > o.priority ? 1 : this.priority < o.priority ? -1 : 0;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public HTTPEvents getEvents() {
		return events;
	}

	public void setEvents(HTTPEvents events) {
		this.events = events;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public JobHandler getHandler() {
		return handler;
	}

	public void setHandler(JobHandler handler) {
		this.handler = handler;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public String getMsgId() {
		return msgId;
	}

	public void setMsgId(String msgId) {
		this.msgId = msgId;
	}
}